python/xc: Fix multiple issues in pyxc_readconsolering()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 27 Nov 2014 12:34:33 +0000 (12:34 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 4 Dec 2014 12:06:54 +0000 (12:06 +0000)
commit9592f35c49a912cd5e48c8b105d0ff575d54dfa2
treee2c7b579dbd8e6494cdba44a31c4846a59e39f1a
parent6848e6e8f3e02db8ed32c153e96e82352110bc80
python/xc: Fix multiple issues in pyxc_readconsolering()

Don't leak a 16k allocation if PyArg_ParseTupleAndKeywords() or the first
xc_readconsolering() fail.  It is trivial to run throught the processes memory
by repeatedly passing junk parameters to this function.

In the case that the call to xc_readconsolering() in the while loop fails,
reinstate str before breaking out, and passing a spurious pointer to free().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Coverity-IDs: 1054984 1055906
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Xen Coverity Team <coverity@xen.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/python/xen/lowlevel/xc/xc.c